/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.UseCases;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.ListProperty;
import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.MetaTypedList;
import edu.pku.sei.modeler.model.uml.Interfaces.BehavioredClassifier;
import edu.pku.sei.modeler.model.uml.Kernel.Classifier;
import edu.pku.sei.modeler.model.xml.XMLUtility;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class UseCase extends BehavioredClassifier implements IUseCase {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList extensionPoint;
	
	protected MetaTypedList extend;
	
	protected MetaTypedList include;
	
	protected MetaTypedList subject;
	
	//added by zsj, for usecase discription
	private String description = "Usecase";
	
	//end of adding
	
	
	
	// getters & setters for attributes
	
	// getters for references
	@MethodProperty(
			id = "USECASE_EXTENSIONPOINT",
			catalog = "Other",
			name = ModelPackage.USECASE_EXTENSIONPOINT
			)
	@ListProperty(
			allowTypes = {ExtensionPoint.class},
			newInstanceMethod = "newInstance",
			typeString = ModelPackage.__EXTENSIONPOINT__
			)

	public MetaTypedList getExtensionPoint() {
		if(extensionPoint == null) {
			extensionPoint = new MetaTypedList(ExtensionPoint.class, this, ModelPackage.USECASE_EXTENSIONPOINT);
		}
		return extensionPoint;
	}
	
	public MetaTypedList getExtend() {
		if(extend == null) {
			extend = new MetaTypedList(Extend.class, this, ModelPackage.USECASE_EXTEND);
		}
		return extend;
	}
	
	public MetaTypedList getInclude() {
		if(include == null) {
			include = new MetaTypedList(Include.class, this, ModelPackage.USECASE_INCLUDE);
		}
		return include;
	}
	
	public MetaTypedList getSubject() {
		if(subject == null) {
			subject = new MetaTypedList(Classifier.class, this, ModelPackage.USECASE_SUBJECT);
		}
		return subject;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.USECASE_EXTENSIONPOINT, extensionPoint);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.USECASE_EXTEND, extend);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.USECASE_INCLUDE, include);
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.USECASE_SUBJECT, subject);	
		
		XMLUtility.xmlInstance.serializeAttribute(root, "description", description);
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getExtensionPoint().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.USECASE_EXTENSIONPOINT));
		
		this.getExtend().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.USECASE_EXTEND));
		
		this.getInclude().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.USECASE_INCLUDE));
		
		this.getSubject().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.USECASE_SUBJECT, this));
		
		
		description = XMLUtility.xmlInstance.deSerializeString(root, "description");
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.USECASE_SUBJECT.equals(featureID)) {
			getSubject().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
 
 
 
 
 